Hi to all!!!

I have prepared a notebook that works on both COLAB and KAGGLE!!!

In versions 3 and 4 I show the model I treated on Google COLAB for this notebook https://www.kaggle.com/aikhmelnytskyy/bagging-rainforest

IMPORTANTLY! This notebook didn't work after the changes to kaggle, but thanks to a discussion by Martin Görner and Allohvk (https://www.kaggle.com/c/rfcx-species-audio-detection/discussion/216408 ), I made the necessary changes in version 4 and now everything works. Here are the changes: from

@tf.function

def _preprocess_img(x, training=False, test=False):

to

@tf.function def _preprocess_img(x, training=False, test=False):

And from

def _specaugment(image):

image = tfa.image.cutout(image, [HEIGHT, xsize[0]], offset=[HEIGHT//2, xoff[0]])
image = tfa.image.cutout(image, [HEIGHT, xsize[1]], offset=[HEIGHT//2, xoff[1]])
image = tfa.image.cutout(image, [ysize[0], WIDTH], offset=[yoff[0], WIDTH//2])
image = tfa.image.cutout(image, [ysize[1], WIDTH], offset=[yoff[1], WIDTH//2])
image = tf.squeeze(image, axis=0)
return image

to

#image = tfa.image.cutout(image, [HEIGHT, xsize[0]], offset=[HEIGHT//2, xoff[0]])
#image = tfa.image.cutout(image, [HEIGHT, xsize[1]], offset=[HEIGHT//2, xoff[1]])
#image = tfa.image.cutout(image, [ysize[0], WIDTH], offset=[yoff[0], WIDTH//2])
#image = tfa.image.cutout(image, [ysize[1], WIDTH], offset=[yoff[1], WIDTH//2])
image = tf.squeeze(image, axis=0)
return image

Version 5 changes as shown in this discussion https://www.kaggle.com/c/rfcx-species-audio-detection/discussion/218930 (special thanks to the author)

I used these notebooks as a basis: https://www.kaggle.com/mekhdigakhramanian/rfcx-resnet50-tpu https://www.kaggle.com/khoongweihao/resnet34-more-augmentations-mixup-tta-inference

It is important to work with colab you need kaggle.json (https://www.kaggle.com/docs/api)

I also created a folder called Models on my Google Drive and put the kaggle.json file in it.

Explore the tfrecords, Create dataset

parse tfrecords

create mel-spectrogram

create labels

proprocessing and data augmentation

In training, I use

Model

Stratified 5-Fold

Other setup

Metrics

Testset and Inference function

Now start training!

If you like my notebook don't forget to upvoted it

If you have questions then ask, I will help as I can